<?php
class ServButtonPhoneRequestForm extends BaseForm
{
    public function configure()
    {
        $this->setWidgets(
                array(
                    'phone' => new sfWidgetFormInputText(
                            array('label' => 'Numero de celular',),
                            array())
                ));

        $this->widgetSchema->setHelp('phone', 'Por ejemplo: 416-789-1234');

        $this->setValidators(array(
            'email' => new myValidatorPhone(
                    array('required' => true),
                    array(
                        'required' => 'Debe indicar un número de telefono celular.',
                        'invalid'  => 'Formato número de celular invalido.'
                ))
            ));

        $this->widgetSchema->setNameFormat('request[%s]');

        $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

        parent::setup();
    }
}